﻿<%@ Application Language="C#" %>

            
<script runat="server">
  log4net.ILog fileLogger; 
  void Application_Start(object sender, EventArgs e)
  {
    // Code that runs on application startup
   
    log4net.Config.XmlConfigurator.Configure();
     
  }

  void Application_End(object sender, EventArgs e)
  {
    //  Code that runs on application shutdown


  }

  void Application_Error(object sender, EventArgs e)
  {
    //get base Url
     string  baseUrl=string.Empty;
     string url = this.Request.ApplicationPath;
     if (url.EndsWith("/"))
                  baseUrl=url;
     else 
         baseUrl=url + "/";
     string root = this.Request.Url.AbsoluteUri.Replace(this.Request.Url.PathAndQuery, "") + baseUrl;
      
    // Code that runs when an unhandled error occurs
    Exception ex = Server.GetLastError().GetBaseException();
    string message = ex.Message +
                     "\nSOURCE: " + ex.Source +
                     "\nFORM: " + Request.Form.ToString() +
                     "\nQUERYSTRING: " +
                        Request.QueryString.ToString() +
                     "\nTARGETSITE: " + ex.TargetSite +
                     "\nSTACKTRACE: " + ex.StackTrace;
    // Code that runs when an unhandled error occurs
    fileLogger = log4net.LogManager.GetLogger("log4net");
    fileLogger.Error(message);
    fileLogger = null;
     // this.uUrlReferrer	{http://localhost:1149/VNH/Default.aspx}	System.Uri
  //  string pageName = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1].ToString();
  // Response.Redirect(root + "PageError.aspx");
  }

  void Session_Start(object sender, EventArgs e)
  {
      Session["key"]=string.Empty;
      Session["cate"]=string.Empty;
      Session["tonkho"] = string.Empty;
  }

  void Session_End(object sender, EventArgs e)
  {
      Session.RemoveAll();
     // Session.Remove(SharedFunction.DEFAULT_PREV_LANGUAGE);
      //Session[SharedFunction.DEFAULT_PREV_LANGUAGE]
    // Code that runs when a session ends. 
    // Note: The Session_End event is raised only when the sessionstate mode
    // is set to InProc in the Web.config file. If session mode is set to StateServer 
    // or SQLServer, the event is not raised.
    // Decrease the active visitors count when the session ends.
   
  }
  void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs e)
  {
    // get a reference to the previously anonymous user's profile
    //ProfileCommon anonProfile = this.Profile.GetProfile(e.AnonymousID);
    // if set, copy its Theme and ShoppingCart to the current user's profile
    //if (anonProfile.ShoppingCart.Items.Count > 0)
    //  this.Profile.ShoppingCart = anonProfile.ShoppingCart;
    //if (anonProfile.ShoppingCart.Items == null)
    //  anonProfile.ShoppingCart = new ShoppingCart();


  }


</script>
